#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
RUN apt-get update; apt-get install libfontconfig1 -y

WORKDIR /app
EXPOSE 9991

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Mercury.WebApi/Mercury.WebApi.csproj", "Mercury.WebApi/"]
COPY ["Mercury.System/Mercury.System.csproj", "Mercury.System/"]
COPY ["Mercury.Core/Mercury.Core.csproj", "Mercury.Core/"]
COPY ["Mercury.Entity/Mercury.Entity.csproj", "Mercury.Entity/"]
COPY ["Mercury.Order/Mercury.Order.csproj", "Mercury.Order/"]
COPY ["Mercury.AppManager/Mercury.AppManager.csproj", "Mercury.AppManager/"]
COPY ["Mercury.Builder/Mercury.Builder.csproj", "Mercury.Builder/"]
RUN dotnet restore "Mercury.WebApi/Mercury.WebApi.csproj"
COPY . .
WORKDIR "/src/Mercury.WebApi"
RUN dotnet build "Mercury.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Mercury.WebApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Mercury.WebApi.dll"]
